<%-- 
    Document   : index
    Author     : Jagadeesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="model.UserBean" %>
<%@page import="java.sql.*"%>
<%@page import="database.DBClass"%>
<%@page import="java.util.List"%>
<link rel="stylesheet" href="css/bootstrap.css">
<link href="css/style.css" rel="stylesheet"> 
            <link href="css/bootstrap.css" rel="stylesheet"> 

                <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
                <script type="text/javascript">
                   

                    function lookup(inputString) {
                        if (inputString.length === 0) {
                            $('#suggestions').hide();
                        } else {
                            $.post("List.jsp", {queryString: "" + inputString + ""}, function(data) {
                                if (data.length > 0) {
                                    $('#suggestions').show();
                                    $('#autoSuggestionsList').html(data);

                                }
                            });
                        }
                    }
                    function fill(thisValue) {
                        $('#inputString').val(thisValue);
                        setTimeout("$('#suggestions').hide();", 200);
                    }
                </script>
<%
    if (session.getAttribute("userName") == null) {

        RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
        rd.forward(request, response);
    }

    UserBean bean;
    bean = new UserBean();
  if (request.getAttribute("error") != null) {
        bean = (UserBean) request.getAttribute("error");
    }
    if (request.getAttribute("updateuser") != null) {
        bean = (UserBean) request.getAttribute("updateuser");
    }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="js/show.js"></script>

        <title>Cari</title>
    </head>
    <body>
        
        <center>
             <img src="gambar/head2.PNG" id="logo" alt="logo">
            <h1>Pencarian </h1>

            <form method="post" action="CariServlet">

                  <TABLE border="0"width="500px">
                    <TR>
                        <TD width="150px">Masukkan Keyword:</TD>
                        <TD>
                            <INPUT TYPE="text" NAME="namaSenjata" value="<%=bean.getNamaSenjata()%>" id="inputString" onkeyup="lookup(this.value);" onblur="fill();">
                            
                             </div>
                <div class="suggestionsBox" id="suggestions" style="display: none;">
                    <div class="suggestionList" id="autoSuggestionsList">
                    </div>
                </div>
                        </TD>
                      
                    </TR>
                    
                    <TR>
                        <TD colspan="2" align="center">

                             <INPUT TYPE="submit" class="btn btn-primary" value="<%=bean.getAction()%>" name="action"></input>

                            <a class="btn btn-default" href="ControllerServlet?action=cancel2">Cancel</a>

                        </TD>
                        <TD>
                            &nbsp;
                        </TD>
                    </TR>

                </TABLE>

            </form>

        </center>
    </body>
</html>
